package com.yonyougov.devops.cruxcisupport.envversionhistory;

import com.yonyougov.devops.cruxcisupport.envversionhistory.vo.EnvVersionHistoryPageLikeDto;
import com.yonyougov.devops.cruxcisupport.envversionhistory.vo.EnvVersionHistoryPageLikeVo;
import com.yonyougov.devops.fwc.core.dao.impl.BaseDaoImpl;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

import java.math.BigInteger;
import java.util.List;

/**
 * 环境应用版本历史表数据层实现
 */
@Repository
public class EnvVersionHistoryDaoImpl extends BaseDaoImpl<EnvVersionHistoryEntity, BigInteger> implements EnvVersionHistoryDao {

    private final SqlSessionTemplate sqlSessionTemplate;

    EnvVersionHistoryDaoImpl(SqlSessionTemplate sqlSessionTemplate) {
        this.sqlSessionTemplate = sqlSessionTemplate;
    }

    @Override
    public int countByEnvVersionHistoryLike(EnvVersionHistoryPageLikeDto envVersionHistoryPageLikeReqVo) {
        String statement = EnvVersionHistoryEntity.class.getName() + "Mapper.countBySinglePageLike";
        return sqlSessionTemplate.selectOne(statement, envVersionHistoryPageLikeReqVo);
    }

    @Override
    public List<EnvVersionHistoryPageLikeVo> findByEnvVersionHistoryPageLike(EnvVersionHistoryPageLikeDto envVersionHistoryPageLikeReqVo) {
        String statement = EnvVersionHistoryEntity.class.getName() + "Mapper.findSinglePageLike";
        return sqlSessionTemplate.selectList(statement, envVersionHistoryPageLikeReqVo);
    }
    //<!--用户自定义代码开始-->

    //<!--用户自定义代码结束-->
}
